<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="shortcut icon" href="favicon.ico"> <link href="/css/bootstrap.min.css?v=3.3.5" rel="stylesheet">
    <link href="/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="/css/animate.min.css" rel="stylesheet">
<!--     <meta content="application/json"/> -->
    <meta http-equiv="Cache-control" content="no-cache">
	<meta http-equiv="Cache" content="no-cache">
    <link href="/css/style.min.css?v=4.0.0" rel="stylesheet"><base target="_blank">

	<!-- 下拉 -->
	<link href="/css/plugins/chosen/chosen.css" rel="stylesheet">
</head>

<body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-6">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <form class="form-horizontal m-t" id="signupForm">
                        	<!-- 临时对象 -->
                        	<input type="hidden" id="copyCompanyId"/>
                        	<input type="hidden" name="companyUserId" type="text"/>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">用户账号：</label>
                                <div class="col-sm-8">
                                    <input id="accountno" name="accountno" readonly="readonly" class="form-control" type="text" aria-required="true" aria-invalid="true" class="error">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系人：</label>
                                <div class="col-sm-8">
                                    <input id="contactname" name="contactname" class="form-control" type="text">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-3 control-label">联系电话：</label>
                                <div class="col-sm-8">
                                    <input id="tel" name="tel" class="form-control" type="text" >
                                </div>
                            </div>
                             <div class="form-group">
                            	<label class="col-sm-3 control-label">所属资金方</label>
                            	<div class="col-sm-8">
                            		<select  data-placeholder="选择资金方" tabindex="4"
										data-placeholder="选择资金方..." name="companyId" style="width: 250px;"
										id="companyId" class="chosen-select">
									</select>
                            	</div>
                            </div>
                            <div class="form-group">
                                <div class="col-sm-8 col-sm-offset-8">
                                    <button class="btn btn-primary" type="submit">提交</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script src="/js/jquery.min.js?v=2.1.4"></script>
    <script src="/js/bootstrap.min.js?v=3.3.5"></script>
    <script src="/js/content.min.js?v=1.0.0"></script>
    <script src="/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="/js/plugins/validate/messages_zh.min.js"></script>
    <script src="/js/plugins/layer-pc/layer.js"></script>
    <script src="/common/form-validator.js"></script>
    <script src="/common/petecat.js"></script>
    <script src="/js/jquery.cookie.js"></script>
    <!-- 组件通用 -->
    <script src="/common/frame.js"></script>
	<!-- 下拉 -->
	<script src="/js/plugins/chosen/chosen.jquery.js"></script>
	<script type="text/javascript">
	    checkPowerAndJump("MODSYSUSER");
		$(function(){
			
			initSelect();
			var e = "<i class='fa fa-times-circle'></i> ";
		    $("#signupForm").validate({
		    	 rules: {
			        	password:{
			        		required: !0,
			        		minlength:6,
			        		maxlength:20
			        	},
			            confirm_password: {
			                required: !0,
			                minlength: 6,
			                equalTo: "#password"
			            },
			        	accountno: {
			                required: !0,
			                minlength: 5,
			                maxlength: 11,
			                isWord:true
			            },
			            contactname: {
			                required: !0,
			                maxlength: 12,
			                minlength: 2
			            },
			            tel: {
			                required: !0,
			                digits:true,
			                maxlength:11,
			                isPhone: true
			            }
			        },
			        messages: {
			        	password:{
			        		required: e + "密码不能为空",
			        		minlength:e + "密码长度必须6位以上",
			        		maxlength:e + "密码长度最多20个字符"
			        	},
	 		            confirm_password: {
	 		                required: e + "请再次输入密码",
	 		                minlength: e + "密码必须6个字符以上",
	 		                equalTo: e + "两次输入的密码不一致"
	 		            },
			            accountno: {
			                required: e + "请输入用户账号",
			                minlength: e + "用户名必须五个字符以上",
			                maxlength: e + "用户名不能超过11位字符",
			                isWord:e + "用户名由字母或数字组成"
			            },
			            contactname: {
			                required: e + "请输入联系人",
			                maxlength: e + "联系人不能超过12位字符",
			                minlength: e + "联系人必须二个字符以上"
			            },
			            tel:{
			            	 required: e + "请输入你手机号",
			            	 digits : e + "手机号必须是整数",
			            	 maxlength:e + "手机号为11位数",
			            	 isPhone: e + "不符合手机号规则" 
			            }
			        },
		        submitHandler:function(form){
		        	var data = serializeForm(form);
		        	var formData = JSON.stringify(data);
		        	var req = {};
		        	req['reqJSON'] = {
	        			type : 'put',
	        			url : SSO_URL+'sy/sysfunduser/updateFundUser',
	        			data : formData
		        	};
		        	req['useToken'] = true;
		        	
		        	req['successFn'] = function(respData){
		        		layer.msg(respData.message, {icon: 6,time:1000},function(){
        					if(respData.code == SUCCESS_CODE){
    						 	var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
   	                        	parent.layer.close(index);  
        					}
        				}); 
		        	};
		        	
		        	ajaxRequest(req);
		        }
		    })
		});
		
		function initSelect(){
			$('#companyId').chosen();
			
			var req = {};
        	req['reqJSON'] = {
    			type : 'get',
    			url : BUSINESS_URL+'bs/sysfund/queryAll'
        	};
        	req['useToken'] = true;
        	
        	req['successFn'] = function(respData){
				if(respData.code == SUCCESS_CODE){
					var items = {};
		        	items['id'] = 'companyId';
		        	items['data'] = respData.data;
		        	items['key'] = 'companyId';
		        	items['value'] = 'companyName';
					selectAppend(items);
					
					$('#companyId').val($('#copyCompanyId').val());
					$('#companyId').trigger("chosen:updated")
				}
        	};
        	
        	ajaxRequest(req);
		}
	</script>
</body>
</html>